<template>
  <div>
    待映
    <!-- <div v-for="item in daiyinglist" :key="item.id">{{ item.nm }}</div> -->
    <div v-for="(value, key) in daiyinglist" :key="key">
      <div>{{ key }}</div>
      <ul>
        <li v-for="item in value" :key="item.id">
          <img :src="item.img" />
          {{ item.nm }}
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
import axios from "axios";
export default {
  name: "Daiying",
  data: function () {
    return {
      daiyinglist: [],
    };
  },
  created() {
    axios
      .get(
        "/ajax/comingList?ci=30&token=&limit=10&optimus_uuid=3084E8D0146211ECA50A477D88250D251D93073CCDCC41D9A4CAC797521EC42D&optimus_risk_level=71&optimus_code=10"
      )
      .then((res) => {
        console.log(res);
        var list = res.data.coming;
        var daiying = {};
        //怎样将 一维数组 按照 日期转为二维数组
        list.forEach((item) => {
          item.img = item.img.replace("w.h", "128.180");
          if (daiying[item.comingTitle]) {
            daiying[item.comingTitle].push(item);
          } else {
            //待映的对象里创建了一个新的数组
            daiying[item.comingTitle] = [];
            daiying[item.comingTitle].push(item);
          }
        });
        console.log(daiying);
        this.daiyinglist = daiying;
      });
  },
};
</script>

<style>
</style>